<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>显示所有供应商</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
	<script>
		$(function(){
			$.post("getAll.do",function(data) { //等同与$.ajax中的success:function(data){}
		var v = JSON.parse(data); //因为回传的是text类型要转化成--->jso格式，然后提取内容
		//var v = $(data);
		var tb = $("<tr>" + "<td>供应商姓名：</td>" +
				"</tr>");
		$("#tb").append(tb);
		for (var i = 0; i < v.length; i++) {
			var tr = $("<tr>" + "<td>" +v[i].proName + "</td>" +
				"</tr>");
			$("#tb").append(tr);
			if (i % 2 != 0) {
				tr.css("background", "#B3D9FF");
			}
		}
	}, "text");
		});
	</script>
  </head>
  
  <body>
    <table id = "tb"></table>
  </body>
</html>
